package com.kancy.xml.entity;

import javax.xml.bind.annotation.*;

/**相当于所有字段都加上@XmlElement
 *  1.可以通过在字段上加@XmlAttribute变成属性
 *  2.@XmlTransient标注字段步映射 */
@XmlAccessorType(XmlAccessType.FIELD)
/**使用了XmlType 需要指定所有字段顺序*/
@XmlType(propOrder = {
        "name","value"
})
public class Property {

    /**配合@XmlAccessorType 一起使用，标识该字段不参与映射*/
    @XmlTransient
    private long id;
    @XmlAttribute
    private String name;

    private String value;

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public Property() {
    }

    public Property(String name, String value) {
        this.name = name;
        this.value = value;
    }

    @Override
    public String toString() {
        return "Property{" +
                "name='" + name + '\'' +
                ", value='" + value + '\'' +
                '}';
    }
}
